﻿#ifndef TLVTABLEWIDGET_H
#define TLVTABLEWIDGET_H

#include "components/CustomTableWidget/CustomTableWidget.h"
#include "services/tlv/Base/tlv.h"
#include "stores/TlvProject/TlvDataModelTypeDef.h"

class TlvTableWidget : public CustomTableWidget
{
    Q_OBJECT
public:
    explicit TlvTableWidget(QWidget *parent = nullptr);

    void addTlvCmd(const QString& desc, const QString& tag, const QString& val, const QString& waitMs="1000");
    void addTlvCmd(const QString& desc, uint16_t tag, const QByteArray& val, uint16_t waitMs=1000);
    void addTlvCmd(const QString& desc, const Tlv& tlv, const QString& waitMs="1000");
    void addTlvCmd(const QString& desc, const Tlv& tlv, uint16_t waitMs=1000);
    void addNewLine();
    void insertNewLine(int row);

    void enableTagAutoComplete(bool en);

    bool getRowTlv(int row, Tlv* oTlv, uint16_t* oWaitMs);

    QList<TlvCmdModel> toTlvCmdModel();

public slots:
    void sendTlv(int row);
    bool sendSelected();

protected:
    void insertTlvCmd(int row, const QString& desc, const QString& tag, const QString& val, const QString& waitMs="1000");
};

#endif // TLVTABLEWIDGET_H
